<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="ch01.FirstlevelTitle"%>
<%@ page import="ch03.FirstLevelTitleDbOpreation"%>
<%@ page import="ch01.User"%>
<%
	User loginUser = (User) session.getAttribute("LOGIN USER");
	if (loginUser == null) {
		response.sendRedirect("login.html");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>saveFirstLevelTitle</title>
</head>
<body>
	<%
		request.setCharacterEncoding("UTF-8");
		String titleName = request.getParameter("titlename");
	%>
	<%
		FirstlevelTitle fTitle = new FirstlevelTitle();
		fTitle.setTitleName(titleName);
		fTitle.setCreator("管理员");
		
		int result = FirstLevelTitleDbOpreation.insertOneRecord(fTitle);
		if (result > 0) {
			request.getRequestDispatcher("onetitle_sucess.jsp").forward(request, response);
		} else {
			request.getRequestDispatcher("error.jsp").forward(request, response);
		}
	 %>
</body>
</html>